﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Gaiocorp.SLMapViewer.Legend
{
    public class LegendSymbol
    {
        private string _Name;
        private string _SymbolUri;
        private BitmapImage _SymbolImage;

        public string Name 
        {
            get { return _Name;}
        }
      
        public string SymbolUri 
        {
            get {return _SymbolUri;}
        }

        public BitmapImage SymbolImage 
        {
            get { return _SymbolImage;}
        }
        
        public LegendSymbol(string sName, string sUri)
        {
            Clear();
            LoadValues(sName, sUri);
        }

        private void loadimage(string imageUri)
        {
            Uri aUri = new Uri(imageUri);
            _SymbolImage = new BitmapImage(aUri);
            
        }

        public void Clear()
        {
            _Name = string.Empty;
            _SymbolImage = null;
            _SymbolUri = string.Empty;
        }
        public void LoadValues(string sName, string sUri)
        {
            Clear();
            _Name = sName;
            _SymbolUri = sUri;
            loadimage(sUri);
        }
    }

    public class LegendSymbols : System.Collections.Generic.List<LegendSymbol>
    {
        public LegendSymbol getSymbolByName(string symbolName)
        {
            foreach (LegendSymbol obj in this)
            {
                if (obj.Name==symbolName) return obj;
            }
            return null;
        }
    }
}
